package cn.wolfcode.luowowo.mgrsite.controller;

import cn.wolfcode.luowowo.article.domain.TravelContent;
import cn.wolfcode.luowowo.article.query.TravelQuery;
import cn.wolfcode.luowowo.article.service.ITravelContentService;
import cn.wolfcode.luowowo.article.service.ITravelService;
import cn.wolfcode.luowowo.common.utils.AjaxResult;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("travel")
public class TravelController {

    @Reference
    private ITravelService travelService;
    @Reference
    private ITravelContentService travelContentService;
    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo")TravelQuery qo){

        //pageInfo
        model.addAttribute("pageInfo",travelService.query(qo));

        return "travel/list";

    }

    @RequestMapping("/getContentById")
    @ResponseBody
    public Object getContentById(Long id){
        TravelContent travelContent = travelContentService.get(id);
        return AjaxResult.SUCCESS.addData(travelContent.getContent());

    }




















}
